#pragma once
#include "core/MainLoop.h"
#include "core/Options.h"


/////////////////////////////////////////////////////////////////////////////////

class ENGINE_API AppRoot : boost::noncopyable 
{
	typedef std::list<std::unique_ptr<ISubsystem>> AppSubsystemList;

public:
	AppRoot(void);
	~AppRoot(void);

	// punto di ingresso applicazione
	void main(PlatformData platformData) throw (CoreException);

	MainLoop& getMainLoop();

private:
	PlatformData platformData;
	Options options;		
	
	MainLoop mainLoop;	
	AppSubsystemList subsystemList;

	int init(PlatformData platformData) throw(InitException);
	int runResourceLoader(void) throw(InitException);

	// esecuzione principale 
	int runMainLoop(void) throw(...);

	// chiusura e libera risorse
	int end(void) throw(ExitException);
	

private:
	////non copy costrucotor
	//AppRoot(const AppRoot&);
	////non assignement operator
	//AppRoot& operator=(const AppRoot&);

};



//SINGLETON MAIN
//extern ENGINE_API	AppRoot		APPROOT;